home *** CD-ROM | disk | FTP | other *** search
-
- package SYM_UTIL is
- -- Global debug switch.
- SYM_UTIL_DEBUG: BOOLEAN := FALSE ;
- -- Add symbol to table.
- procedure SYM_ADD (NAME: STRING, VALUE: INTEGER)
- -- Delete symbol from table.
- procedure SYM_DELETE (NAME: STRING) ;
- -- Lookup a symbol.
- function SYM_LOOKUP (NAME: STRING) return INTEGER ;
- end SYM_UTIL ;
-
- package body SYM_UTIL is
- -- Internal variables.
- type SYMBOL_NODE is record
- ...
- end record ;
- SYMBOL_LIST: access SYMBOL_NODE := null ;
- -- Public functions.
- procedure SYM_ADD (NAME: STRING, VALUE: INTEGER) is
- begin
- ... adds NAME/VALUE pair to the symbol table ...
- end SYM_ADD ;
-
- procedure SYM_DELETE (NAME: STRING) is
- begin
- ... deletes NAME from the symbol table ...
- end SYM_DELETE ;
-
- function SYM_LOOKUP (NAME: STRING) return INTEGER is
- begin
- ... returns NAME's value from the symbol table ...
- end SYM_LOOKUP ;
- -- Internal function called
- -- by the other functions.
- function SYM_LOCATE (NAME: STRING)
- return access SYMBOL_NODE is
- begin
- ... locates NAME's node in the symbol list ...
- end SYM_LOCATE ;
-
- end SYM_UTIL ;
-
-
- Listing 1: Ada Symbol Table Package
- -----------------------------------
-
-
-